package com.fc.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.fc.system.dao.DictCodeDAO;
import com.fc.system.entity.DictCode;
import com.fc.system.service.DictCodeService;
import com.fc.tms.constant.CacheKey;

@Service("dictCodeService")
public class DictCodeServiceImpl implements DictCodeService {

    @Resource
    DictCodeDAO dictCodeDAO;

    @Override
    @Cacheable(value = CacheKey.DICTIONARY, key = "'one_'+#masterCode+'_'+#name")
    public DictCode getByValue(String masterCode, String name) {
        return dictCodeDAO.getByValue(masterCode, name);
    }

    @Override
    @Cacheable(value = CacheKey.DICTIONARY, key = "'list_'+#masterCode")
    public List<DictCode> find(String masterCode) {
        return dictCodeDAO.find(masterCode);
    }
}